package xeichengbishi;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
/**
 * Created by JiaJia on 2019/9/4 0004.
 */
public class Xiecheng02 {
    static String resolve(String expr) {
        Stack<Integer> stack=new Stack<>();
        int[] num=new int[5000];
        int length=expr.length();
        for (int i = 0; i <length ; i++) {
            if (expr.charAt(i)=='('){
                stack.push(i);
            }else if (expr.charAt(i)==')'){
                num[i]=stack.peek();
                num[stack.peek()]=i;
                stack.pop();
            }
        }
        int fin=1;
        StringBuilder result=new StringBuilder();
        for (int i = 0; i <length ; ) {
            if (expr.charAt(i)=='('||expr.charAt(i)==')'){
                i=num[i];
                fin=-fin;
            }else {
                result.append(expr.charAt(i));
            }
            i+=fin;
        }
        return result.toString();
    }
    /******************************结束写代码******************************/


    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String res;

        String _expr;
        try {
            _expr = in.nextLine();
        } catch (Exception e) {
            _expr = null;
        }

        res = resolve(_expr);
        System.out.println(res);
    }
}